import 'package:concert_ticket_client/app/model/bo/login_model/LoginModel.dart';
import 'package:concert_ticket_client/app/model/bo/register_model/RegisterModel.dart';
import 'package:flutter/cupertino.dart';
import 'package:get/get.dart';
import 'package:get/get_rx/get_rx.dart';
import 'package:get/get_rx/src/rx_types/rx_types.dart';

class AuthController extends GetxController {

  Rx<LoginModel> loginModel = Rx<LoginModel>(LoginModel());

  Rx<RegisterModel> registerModel = Rx<RegisterModel>(RegisterModel());

  Rx<bool> isLogin = Rx<bool>(true);

  RxMap<String,  TextEditingController> loginControllerMap = RxMap({
    "account": TextEditingController(text: ''),
    "password": TextEditingController(text: ''),
  });

  RxMap<String,  TextEditingController> registerControllerMap = RxMap({
    "nickname": TextEditingController(text: ''),
    "username": TextEditingController(text: ''),
    "email": TextEditingController(text: ''),
    "phone": TextEditingController(text: ''),
    "validateCode": TextEditingController(text: ''),
    "password": TextEditingController(text: ''),
    "confirmPassword": TextEditingController(text: ''),
  });

  RxBool showLoginPassword = true.obs;
  RxBool showRegisterPassword = true.obs;
  RxBool showRegisterConfirmPassword = true.obs;

  @override
  void onInit() {
    super.onInit();
  }

  @override
  void onReady() {
    super.onReady();
  }

  @override
  void onClose() {
    super.onClose();
  }

  void switchToLogin() {
    isLogin.value = true;
  }

  void switchToRegister() {
    isLogin.value = false;
  }

}
